home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
program
/
swagd_f.zip
/
DIRS.SWG
/
0042_Kill directories and files.pas
< prev
Wrap
Pascal/Delphi Source File
|
1995-02-28
|
897b
|
45 lines
{$A+,B-,D-,E-,F-,G-,I-,L-,N-,O-,R-,S-,V-,X-}
{$M 16384,0,655360}
uses dos;
procedure kill;
var
sr : searchrec;
f : file;
begin
findfirst('*.*',AnyFile xor VolumeId,sr);
repeat
if boolean(sr.Attr and Directory) and (sr.name[1]<>'.') then
begin
chdir(sr.name);
kill;
chdir('..');
rmdir(sr.name)
end
else if (sr.name[1]<>'.') then
begin
assign(f,sr.name);
setfattr(f,Archive);
erase(f)
end;
findnext(sr);
until DOSError<>0;
end;
var
s : string;
begin
writeln('All files in directory and subdirectories will be deleted!');
write('Proceed? Y/N');
readln(s);
if upcase(s[1])<>'Y' then HALT;
kill
end.
-----
This one kills all files (in fact it'll sometimes depend on attributes) in
directory and subdirectories. That's almost the same as making a tree...